package com.gaojiawei.multiThread05_ThreeSpecialAtomic;


import org.junit.Test;

/**
 *
 */
public class l07_AtomicWithThreadLocal {

    private ThreadLocal threadLocal1 = new ThreadLocal();

    private ThreadLocal threadLocal2 = new ThreadLocal();


    @Test
    public void testThreadLocal() throws InterruptedException {
        threadLocal1.set("11");
        threadLocal2.set("22");

        new Thread(()->{
            System.out.println(threadLocal1.get());
        }).start();

        new Thread(()->{
            System.out.println(threadLocal2.get());
        }).start();

        Thread.sleep(1000);

        System.out.println(threadLocal1.get());
        System.out.println(threadLocal2.get());



    }

}
